package com.fh.common;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * 返回json的包装类
 * @author huangp
 *
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class ResultMessage {

	private Integer code;//返回的状态码
	
	private String message;//返回的信息
	
	private Object data;//返回的数据

	public ResultMessage(ResultEnum resultEnum) {
		this.code = resultEnum.getCode();
		this.message = resultEnum.getMsg();
	}

	public ResultMessage(ResultEnum resultEnum, Object data) {
		this.code = resultEnum.getCode();
		this.message = resultEnum.getMsg();
		this.data = data;
	}
	public ResultMessage(String message) {
		this.code = 1;
		this.message = message;
	}

	public ResultMessage(Integer code, String message) {
		this.code = 1;
		this.message = message;
	}
}
